import java.util.Locale;

/**
 * @author TANGYE
 * @date 2021/2/26 10:51 上午
 **/
public class XYView {

    public static void main(String[] args) {
        XYView xyView = new XYView();
        System.out.println(xyView.changeFormatNumber("-1A"));
    }

    /**
     * 将输入的十进制数字转换为对应的二进制字符串和十六进制字符串
     * @param number string字符串 十进制数字字符串
     * @return string字符串
     */
    public String changeFormatNumber (String number) {
        // write code here
        try {
            int num = Integer.valueOf(number);
            StringBuilder sb = new StringBuilder();
            if (Math.abs(num) > Math.pow(2,15)-1){
                return "NODATA";
            } else {
                if (num >= 0){
                    return calcNum(num, sb);
                } else {
                    String b = Integer.toBinaryString(num).substring(16);
                    String h = Integer.toHexString(num).substring(4).toUpperCase();
                    return sb.append(b).append(',').append(h).toString();
                }
            }
        } catch (Exception e){
            //e.printStackTrace();
            return "INPUTERROR";
        }
    }

    public static String calcNum(int num, StringBuilder sb){
        // 二进制数
        String b;
        // 十六进制数
        String h;
        b = Integer.toBinaryString(num);

        h = Integer.toHexString(num);
        for(int i = 0, j = 16 - b.length(); i < j; i++){
            sb.append("0");
        }
        sb.append(b).append(",");

        for (int i = 0, j = 4 - h.length(); i<j; i++){
            sb.append("0");
        }
        sb.append(h.toUpperCase());
        return sb.toString();
    }
}
